/***************************************************************************
 *   Copyright (C) 2008 by Eduardo Gurgel Pinho                            *
 *   edgurgel@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#include "photon.h"

namespace Sirat {

namespace Photon_Mapping {

unsigned short Photon::order = 1;

Photon::Photon(const Common::Color& _color,const Math::Vector& _position,const Math::Vector& _direction) : color(_color) , position(_position), direction(_direction)
{ }

/*Photon::Photon(void) : color(Color()), position(Vector()), direction(Vector()) {
}*/

Photon::~Photon(void) { }

void Photon::set_color(const Common::Color& _color) { color = _color; }

void Photon::set_position(const Math::Vector& _position) { position = _position; }

void Photon::set_direction(const Math::Vector& _direction) { direction = _direction; }

void Photon::set_order(unsigned short _order) { order = _order; }

void Photon::next_order(void) { 
	if(order == 3) order = 1;
	else order++;
}

Common::Color Photon::get_color(void) const { return color; }

Math::Vector Photon::get_position(void) const { return position; }

Math::Vector Photon::get_direction(void) const { return direction; }

unsigned short Photon::get_order(void) { return order; }

bool compare (Photon* _first, Photon* _second) {
	unsigned short int order = Photon::get_order();
	if((_first->get_position())[order] <= (_second->get_position())[order]) return true;
	else return false;
}

}

}
